/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import config.Content;
import handler.ClientHandler;
import javax.swing.*;

/**
 *
 * @author Scuba Kay
 */
public class Menu extends JMenuBar {
	public JMenu menuFile, menuView;
	public JMenuItem itemExit, itemSettings, itemLogout;
	public JCheckBoxMenuItem itemShowLog;
	public JPanel buttonPanel, infoPanel;
	public ButtonGroup viewButtonGroup;
	public JRadioButtonMenuItem itemTableView, itemBarGraphView, itemPieChartView;
	private ClientHandler handler;
	
	public Menu(ClientHandler handler){
		this.handler = handler;
	}
	
	/**
	 * This builds up the menubar
	 * @author Kay van Bree
	 * @since 0.2
	 */
	private void setMenu(){
		
		// FILE
		menuFile = new JMenu("File");
		add(menuFile);
		
		itemSettings = new JMenuItem("Settings");
		itemSettings.addActionListener(handler);
		menuFile.add(itemSettings);
		menuFile.addSeparator();
		itemLogout = new JMenuItem("Logout");
		itemLogout.addActionListener(handler);
		menuFile.add(itemLogout);
		itemExit = new JMenuItem("Exit");
		itemExit.addActionListener(handler);
		menuFile.add(itemExit);
		
		// VIEW
		menuView = new JMenu("View");
		add(menuView);
		
		itemShowLog = Content.log.getMenuItem();
		itemShowLog.addItemListener(handler);
		menuView.add(itemShowLog);
		menuView.addSeparator();
		viewButtonGroup = new ButtonGroup();
		itemTableView = new JRadioButtonMenuItem("Table view");
		itemTableView.addActionListener(handler);
		viewButtonGroup.add(itemTableView);
		menuView.add(itemTableView);
		itemPieChartView = new JRadioButtonMenuItem("Pie Chart view");
		itemPieChartView.addActionListener(handler);
		viewButtonGroup.add(itemPieChartView);
		menuView.add(itemPieChartView);
		itemBarGraphView = new JRadioButtonMenuItem("Bar Graph view");
		itemBarGraphView.addActionListener(handler);
		viewButtonGroup.add(itemBarGraphView);
		menuView.add(itemBarGraphView);
	}
}
